﻿@{
    Html.AddScriptParts(Url.Content("~/Plugins/SevenSpikes.Nop.AjaxFilters/Scripts/ManufacturerFilter.js"));
}

@model ManufacturerFilterModel7Spikes
           
@using SevenSpikes.Nop.AjaxFilters.Models.ManufacturerFilter;
@using SevenSpikes.Nop.AjaxFilters.Common;
@using SevenSpikes.Nop.AjaxFilters.Domain;

@if(Model.NopAjaxFiltersSettings.FiltersUIMode == FiltersUIMode.UseDropdowns)
{   
    <script type="text/javascript">

        $(document).ready(function () {

            $("#manufacturerFiltersDropDown").jDropDown();
        })

    </script>
}

<div class="manufacturerFilterPanel7Spikes">
    @{
        Func<int, HelperResult> manufacturerOptionsHtml =
            @<text>
                 @foreach (ManufacturerFilterItem manufacturerFilterItem in Model.ManufacturerFilterItems)
                 {
                     string filterItemCssClass = "filterItemUnselected";

                     if (manufacturerFilterItem.FilterItemState == FilterItemState.Checked)
                     {
                         filterItemCssClass = "filterItemSelected";
                     }
                    
                    <li><a class="@filterItemCssClass" data-option-id="@manufacturerFilterItem.Id">@manufacturerFilterItem.Name</a>
                    </li>
                 }
            </text>;
    }

    <div class="block block-category-navigation">
        <div class="title">
            <a class="toggleControl">@T("Manufacturers")</a>
            <a class="clearFilterOptions">@T("SevenSpikes.NopAjaxFilters.Client.Common.Clear")</a>
           <div class="clear"></div>
        </div>
        <div class="clear">
        </div>
        @if (Model.NopAjaxFiltersSettings.FiltersUIMode == FiltersUIMode.UseCheckboxes)
        {
            <div class="filtersGroupPanel">
                <ul>
                    @manufacturerOptionsHtml(0)
                </ul>
            </div>
        }
        else if (Model.NopAjaxFiltersSettings.FiltersUIMode == FiltersUIMode.UseDropdowns)
        {
            <div class="filtersGroupPanel filtersDropDownPanel" style="z-index: 6;">
                <div id="manufacturerFiltersDropDown" class="filtersDropDown">
                    <div>
                        <p></p>
                    </div>
                    <ul>
                        <li>
                            <a class="allFilterDropDownOptions selected">@T("SevenSpikes.NopAjaxFilters.Client.Common.All")</a>
                        </li>
                        @manufacturerOptionsHtml(0)
                    </ul>
                </div>
            </div>
        }
    </div>
</div>
